package rsb.books;

import java.util.Scanner;

//顾客
public class Person {
    private String name;
    public Person(){
    }
    public Person(String name){
        this.name=name;
    }
    public String getName(){
        return name;
    }
    public void setName(String name){
        this.name=name;
    }
    //购买书的功能
    public Book buy(Book[] books){
        //book表示买到的书
        Book book=null;
        System.out.println("请输入购书编号");
        Scanner sc=new Scanner(System.in);
        int id=sc.nextInt();
        //遍历
        for(int i=0;i<books.length;i++){
            if(books[i].getId()==id){
                book=books[i];
                break;
            }
        }
        return book;
    }
}
